home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / OUI / envman.lha / EnvManager / stringreq.cc < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-08  |  1.1 KB  |  55 lines

  1. // stringreq.cc
  2. // 01.02.95
  3.  
  4. #include "stringreq.h"
  5.  
  6. void rstring::open(screen *nws)
  7. {
  8.  
  9.     strcpy(sname, def) ;
  10.     ws = nws ;
  11.  
  12.     g = new gadgetlist(this, 3) ;
  13.  
  14.     g->box(20, g->fontheight+8, ws->width/2-40, g->fontheight+4) ;
  15.     new string(g, WFUNC(&rstring::fstring), NULL, def) ;
  16.  
  17.     prepbox(TRUE) ;
  18.  
  19.     window::_open(NULL, BUTTONIDCMP,
  20.         WA_Title,               titre,
  21.         WA_Activate,            TRUE,
  22.         WA_DragBar,             TRUE,
  23.         WA_SimpleRefresh,       TRUE,
  24.         WA_Gadgets,             g->glist,
  25.         TAG_DONE) ;
  26.  
  27.     if (initok)
  28.         g->updategadgets() ;
  29. }
  30.  
  31. void rstring::fstring(gadget *g, unsigned long classe, unsigned short code)
  32. {
  33.     strcpy(sname, ((string *)g)->curstring) ;
  34. }
  35.  
  36. STRPTR StringRequest(STRPTR title, STRPTR def)
  37. {
  38. STRPTR retstr=NULL ;
  39. rstring rs(120, 20, 400, 70) ;
  40.  
  41.     rs.def = def ;
  42.     rs.titre = title ;
  43. //    beginWait();
  44.     rs.open(ns) ;
  45.     rs.eventloop() ;
  46.     rs.close() ;
  47. //    endWait() ;
  48.  
  49.     if (rs.okflag) {
  50.         retstr = new char[strlen(rs.sname)+1] ;
  51.         strcpy(retstr, rs.sname) ;
  52.     }
  53.     return retstr ;
  54. }
  55.